<?php


namespace app\common\model;


class UserPlatformTokenModel extends CommonModel
{
    protected $name = 'user_platform_token';

    public function setExpireTimeAttr($v)
    {
        return date('Y-m-d H:i:s', $v);
    }

    public function userInfo(): \think\model\relation\HasOne
    {
        return $this->hasOne(UserModel::class, 'id', 'user_id');
    }

    public function getUserPlatformToken($where = [])
    {
        return $this->with(['userInfo'])->order([])->where($where)->find();
    }
}